import java.util.Scanner;
import java.util.Random;
public class caishu2{
	public static void main(String[] args){
	int x=0,n=0;
	Random rand = new Random();
	for(int m=1;m<999999;m++){
	if(n==1){
		break;
	}
	Scanner input = new Scanner(System.in);
	System.out.println("输入一个价格吧：");
	int a = rand.nextInt(101);
	for(int i=0;i<10;i++){
		int num = input.nextInt();
		if( a == num){
			System.out.print("猜对了！");
			x=1;
			break; 
		}
		else if(num > a){
			System.out.print("价格高了！");
			System.out.println("你还有"+(9-i)+"次机会");
		}
		else if(num < a){
			System.out.print("价格低了！");	
			System.out.println("你还有"+(9-i)+"次机会");
		}			
	}
		if(x==0){
		System.out.println("很遗憾十次机会已经用完,您要继续游戏吗？请输入1继续或者输入0停止");
		}
		else if(x==1){
			System.out.println("请输入1继续或者输入0停止");
		}
		int q = input.nextInt();
		if(q==0){
			break;
		}
		x=0;	
	}

}
	}

